package org.swidgets.base.spanels;




import org.swidgets.base.BorderStyleRepository;

import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;



public class SSimplePanel extends Composite{

	protected final SSimpleFrame cornice=new SSimpleFrame();
	private SimplePanel ssimplepanel=new SimplePanel();
	
	private static final boolean isDesignTime() {
		return false;
	}
	
	public void initSimplePanel(){
		ssimplepanel.add(cornice);	
		cornice.setStyle(BorderStyleRepository.simplePanel);
		cornice.setHeight("100%");
		
	}
	public SSimplePanel(){
		super();
		initWidget(ssimplepanel);
		initSimplePanel();
		if(isDesignTime()){
			this.setHeight("100px");
			this.setWidth("100px");
			cornice.setWidth("100%");
		}
	}
	
	public SSimplePanel(String width,String height){
		super();
		initWidget(ssimplepanel);
		initSimplePanel();
		this.setHeight(height);
		this.setWidth(width);
		
	}
	
	public void add(Widget w){
		cornice.setBodyWidget(w);
	}
	
	
	public void onBrowserEvent(Event event) {
		this.onBrowserEvent(event);
	}

	public void clear() {
		cornice.clearContent();
	}

	
	public boolean remove(Widget w) {
		cornice.clearContent();
		return true;
	}

	public Element getContainerElement() {
		if(isDesignTime()){
			return cornice.getContainer();
		}
		return ssimplepanel.getElement();
	}

	

	
	
	
	
}
